import React from 'react';

interface ProfitTextProps {
  profitValue: number;
  text: string;
}

// 自定义颜色显示组件
const ProfitText: React.FC<ProfitTextProps> = ({ profitValue, text }) => {
  let color: string;
  if (profitValue > 0) {
    // 盈利用红色表示
    color = "#ff4d4f";
  } else if (profitValue < 0) {
    // 亏损用绿色表示
    color = "#52c41a";
  } else {
    // 盈亏平衡用深黑色表示
    color = "#000000";
  }

  return <span style={{ color, fontWeight: "bold" }}>{text}</span>;
};

export default ProfitText;